var id = $("#id").val();
/*
 * @Description: 预加载
 * @param : 
 */
$(function (){
	/*$("#qrcode").qrcode({
		width: 100,
		height: 100,
		correctLevel : 3,
		text: "134564"
	});*/
	$.ajax({
		url:pathUrl("subcout/getSubcout.action"),
		type:'POST',
		dataType:'JSON',
		async : false,
		data:{'id' : id},
		success:function(data){
//			console.log(data)
			var str = "",title;
			var dataNew = data.rows[0];
			str = toUtf8(dataNew.fBillNo+"");
			var key, value;
			for (x in dataNew) {//往span里写值
				key = x;
				value = dataNew[x] == null?"":dataNew[x];
				if(x == 'fFetchDate' || x == 'fBillDate'){
					value = dateFormatter(dataNew[x]);
				}
				$("#"+key).text(value);
			}

			$("#qrcode").qrcode({
				width: 100,
				height: 100,
				correctLevel : 3,
				text: str
			});
		}
	});
	setTimeout(function(){
		print();
	}, 500);
});

/*
 * @Description: 打印
 * @param :
 */
function print() {
	var canvas=document.getElementsByTagName("canvas")[0];
	var dataURL = canvas.toDataURL("image/png");
	var img = '<img src="'+dataURL+'"></img>';
	$("#qrcode").html(img);
	$(".row").print({
		deferred: $.Deferred().done(function() { window.close(); })//打印完后自动关闭打印页面
	});
}